home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-12-07 | 1.9 KB | 72 lines |
- /*
- A basic extension of the java.awt.Dialog class
- */
-
- import java.awt.*;
-
- public class AboutDialog extends Dialog {
- void okButton_Clicked(Event event) {
- //{{CONNECTION
- // Clicked from okButton Hide the Dialog
- hide();
- //}}
- }
-
- public AboutDialog(Frame parent, boolean modal) {
-
- super(parent, modal);
-
- //{{INIT_CONTROLS
- setLayout(null);
- addNotify();
- resize(insets().left + insets().right + 335,insets().top + insets().bottom + 86);
- setFont(new Font("Dialog", Font.BOLD, 12));
- setForeground(new Color(0));
- setBackground(new Color(16777215));
- okButton = new java.awt.Button("OK");
- okButton.reshape(insets().left + 128,insets().top + 48,72,26);
- okButton.setFont(new Font("Dialog", Font.BOLD, 12));
- add(okButton);
- labelAbout = new java.awt.Label("Amazing Adventures Travel - Custom Itinerary Application");
- labelAbout.reshape(insets().left + -8,insets().top + 8,344,31);
- labelAbout.setFont(new Font("Dialog", Font.BOLD, 12));
- labelAbout.setForeground(new Color(0));
- labelAbout.setBackground(new Color(16777215));
- add(labelAbout);
- setTitle("About");
- setResizable(false);
- //}}
- }
-
- public AboutDialog(Frame parent, String title, boolean modal) {
- this(parent, modal);
- setTitle(title);
- }
-
- public synchronized void show() {
- Rectangle bounds = getParent().bounds();
- Rectangle abounds = bounds();
-
- move(bounds.x + (bounds.width - abounds.width)/ 2,
- bounds.y + (bounds.height - abounds.height)/2);
-
- super.show();
- }
-
- public boolean handleEvent(Event event) {
- if(event.id == Event.WINDOW_DESTROY) {
- hide();
- return true;
- }
- if (event.target == okButton && event.id == Event.ACTION_EVENT) {
- okButton_Clicked(event);
- }
- return super.handleEvent(event);
- }
-
- //{{DECLARE_CONTROLS
- java.awt.Button okButton;
- java.awt.Label labelAbout;
- //}}
- }
-